<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="/view/protected/templates/master.xhtml">
		
		<ui:define name="divMain">
			<h:form id="usersForm">
				<p:dataTable id="usersTable" value="#{userMB.allUsers}" var="user"
					emptyMessage="#{bundle.noRecords}" paginator="true" rows="10"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="5,10,15">
					
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bundle.user_name}" />
						</f:facet>

						<h:outputText value="#{user.name}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bundle.user_password}" />
						</f:facet>

						<h:outputText value="#{user.password}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bundle.user_email}" />
						</f:facet>

						<h:outputText value="#{user.email}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bundle.user_numberRegistration}" />
						</f:facet>

						<h:outputText value="#{user.numberRegistration}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bundle.user_profile}" />
						</f:facet>

						<h:outputText value="#{user.profile}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bundle.user_telephone}" />
						</f:facet>

						<h:outputText value="#{user.telephone}" />
					</p:column>


					<p:column>
						<p:commandButton value="#{bundle.detail}" icon="ui-icon-bullet"
							onclick="userDetailDialogWidget.show();"
							update=":userDetailDialogForm">
							<f:setPropertyActionListener target="#{userMB.user}" value="#{user}" />
						</p:commandButton>
						<p:spacer width="10px" />
						<p:commandButton value="#{bundle.button_update}" icon="ui-icon-pencil"
							update=":userUpdateDialogForm"
							onclick="userUpdateDialogWidget.show();">
							<f:setPropertyActionListener target="#{userMB.user}" value="#{user}" />
						</p:commandButton>
						<p:spacer width="10px" />
						<p:commandButton value="#{bundle.button_delete}" icon="ui-icon-trash"
							update=":userDeleteDialogForm"
							onclick="userDeleteDialogWidget.show();">
							<f:setPropertyActionListener target="#{userMB.user}" value="#{user}" />
						</p:commandButton>
					</p:column>

				</p:dataTable>
				<p:commandButton value="#{bundle.button_inserir} #{bundle.user}"
					icon="ui-icon-plus" update=":userCreateDialogForm"
					actionListener="#{userMB.resetUser()}"
					onclick="userCreateDialogWidget.show();" />
			</h:form>

			<ui:include src="/view/protected/admin/user/userCreate.xhtml" />
			<ui:include	src="/view/protected/admin/user/userDetail.xhtml" />
			<ui:include	src="/view/protected/admin/user/userUpdate.xhtml" />
			<ui:include	src="/view/protected/admin/user/userDelete.xhtml" />
		</ui:define>
	</ui:composition>
</h:body>
</html>